import request from 'src/axios'

/**
 * @description 分页查询流程分类
 * @param { Object } params 查询参数
 * @returns Promise
 */
export const pageCategory = (params: object) => {
  return request.get('/flow/flowCategory/page', { params })
}

/**
 * @description 查询启用流程分类
 * @param { Object } params 查询参数
 * @returns Promise
 */
export const listCategory = (params?: object) => {
  return request.get('/flow/flowCategory/list', { params })
}

/**
 * @description 查看流程分类
 * @param { String } id 主键
 * @returns Promise
 */
export const viewCategory = (id: string) => {
  return request.get('/flow/flowCategory', { params: { id } })
}

/**
 * @description 新增流程分类
 * @param { Object } data 新增数据
 * @returns Promise
 */
export const saveCategory = (data: object) => {
  return request.post('/flow/flowCategory', data)
}

/**
 * @description 修改流程分类
 * @param { Object } data 修改数据
 * @returns Promise
 */
export const updateCategory = (data: object) => {
  return request.put('/flow/flowCategory', data)
}

/**
 * @description 删除流程分类
 * @param { Array<string> } ids 主键数组
 * @returns Promise
 */
export const deleteCategory = (ids: Array<string>) => {
  return request.delete('/flow/flowCategory', { data: ids })
}

/**
 * @description 启用流程分类
 * @param { String } id 主键
 * @returns Promise
 */
export const enableCategory = (id: string) => {
  return request.put('/flow/flowCategory/enable', { id })
}

/**
 * @description 禁用流程分类
 * @param { String } id 主键
 * @returns Promise
 */
export const disableCategory = (id: string) => {
  return request.put('/flow/flowCategory/disable', { id })
}
